/* 等值收窄 */
// https://ts.yayujs.com/handbook/Narrowing.html#%E7%AD%89%E5%80%BC%E6%94%B6%E7%AA%84-equality-narrowing
function example(x: string | number, y: string | boolean) {
  if (x === y) {
    // We can now call any 'string' method on 'x' or 'y'.
    x.toUpperCase();
    y.toLowerCase();
  } else {
    console.log(x);
    console.log(y);
  }
}